package com.liuf.quartz.service;

import com.liuf.quartz.domain.ScheduleJob;
import com.liuf.quartz.exception.ServiceException;

import java.util.List;

/**
 * @program: spring-cloud-liuf-master
 * @description: Quartz业务类
 * @author: Mr.Liu
 * @create: 2018-08-30 11:04
 * @码云： https://gitee.com/www.jiandan.com
 **/
public interface IJobService {

    /**
     * 获取所有调度任务
     * @return  List
     */
    List<ScheduleJob> getAllEnableJob();

    /**
     * 根据主键获取任务
     * @param jobId 任务主键
     * @return  任务JOB
     * @throws ServiceException 统一异常处理类
     */
    ScheduleJob select(Long jobId) throws ServiceException;

    /**
     * 修改调度任务
     * @param jobId 调度任务主键
     * @param scheduleJob   调度任务信息
     * @return  object
     * @throws ServiceException 统一日常处理类
     */
    ScheduleJob update(Long jobId, ScheduleJob scheduleJob) throws ServiceException;

    /**
     * 新增调度任务
     * @param scheduleJob   调度任务
     * @return  boolean
     * @throws ServiceException 统一异常处理类
     */
    boolean add(ScheduleJob scheduleJob) throws ServiceException;

    /**
     * 删除调度任务
     * @param jobId 任务主键
     * @return  boolean
     * @throws ServiceException 统一异常处理
     */
    boolean delete(Long jobId) throws ServiceException;

    /**
     * 获取所哟逇调度任务
     * @return  List<Object>
     */
    List<ScheduleJob> getAllJob();

    /**
     * 暂停调度任务
     * @param jobId 任务主键
     * @return  boolean
     * @throws ServiceException 统一异常处理类
     */
    boolean resume(Long jobId) throws ServiceException;

    /**
     * 恢复调度任务
     * @param jobId 主键
     * @return  boolean
     * @throws ServiceException 统一异常处理类
     */
    boolean pause(Long jobId) throws ServiceException;

    /**
     * 运行调度任务
     * @param jobId 任务主键
     * @return  boolean
     * @throws ServiceException 统一异常处理类
     */
    boolean run(Long jobId) throws ServiceException;
}
